<?php 


class mail
{
function send_mail ($to_mail ,$title ,$body)

{

        
        $smtpConfig = array(
        		'host'=>"smtp.qq.com",
        		'auth'=>true,
        		'user'=>"497688075",
        		'pass'=>"abc13419632173",
        		'from'=>"497688075@qq.com",
        		'fromname'=>"zhangqian"
        		);
        require_once 'class.phpmailer.php';
        $mail = new PHPMailer();

        $mail->CharSet = "UTF-8"; // 这里指定字符集

        $mail->IsSMTP();

        $mail->Host = $smtpConfig['host'];

        $mail->SMTPAuth = $smtpConfig['auth']; // turn on SMTP authentication

        $mail->Username = $smtpConfig['user']; // SMTP username 注意：普通邮件认证不需要加 @域名

        $mail->Password = $smtpConfig['pass']; // SMTP password

        $mail->From = $smtpConfig['from']; // 发件人邮箱

        $mail->FromName = $smtpConfig['fromname']; // 发件人

        $mail->AddAddress($to_mail); // 收件人邮箱和姓名

        $mail->IsHTML(true); // send as HTML

                             // 邮件主题

        $mail->Subject = $title;

        $mail->Body = $body;

        $mail->AltBody = strip_tags($body);

        $ret = $mail->Send();

        if (! $ret)

        {

                return $mail->ErrorInfo;

        }

        else

        {

                return true;

        }

}

}
